'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model');

var modelField = {
    Code: {
        type: String,
        Name: '编码',
        IsUnique: true,
        IsEmpty: false,
        trim: true
    },
    Name: {
        type: String,
        Name: '名称',
        IsEmpty: false,
        trim: true
    },
    //上级部门
    ParentDepartment: {
        type: Schema.ObjectId,
        Name: '上级部门',
        ref: 'Department'
    },
    IsEffective: {
        Name: '失效',
        type: Boolean
    },
    Remark: {
        type: String,
        Name: '备注',
        default: '',
        trim: true
    }
}

var newModel = new Model(modelField);
newModel.addIndex({Code: 1});
newModel.create('Department', '部门');

